package com.niiwoo.civet.account.service;

import com.niiwoo.civet.account.dto.request.*;
import com.niiwoo.civet.account.dto.response.*;
import com.niiwoo.civet.account.enums.StatisticalUserBillAmountTypeEnum;
import com.niiwoo.tripod.provider.dto.response.PageResponseDTO;

import java.math.BigDecimal;
import java.util.Date;
import java.util.List;

/**
 * Created by Jaylin on 2017/11/9.
 * 账单查询接口
 */

public interface NiiwooBillDubboService {


    /**
     * 批量添加第三方账单
     *
     * @param thirdBillRequestDTOList
     */
    void addThirdBills(List<AddThirdBillRequestDTO> thirdBillRequestDTOList);

    /**
     * 手动添加账单
     * @param handAddBillAndChangeBalanceDTO
     */
    void handAddBillAndChangeBalance(HandAddBillAndChangeBalanceDTO handAddBillAndChangeBalanceDTO);

    /**
     * 智能投申请
     * @param request
     * @return Long OrderSuccessAccounting的id
     */
    default Long billIntelligenceInvestForApply(BillIntelligenceInvestForApplyRequestDTO request){
        throw new UnsupportedOperationException("unimplemented");
    }

    /**
     * 取消智能投
     * @param userId 用户id
     * @param packageOrderId 智能投产品包的订单id
     */
    default void billIntelligenceInvestCancel(String userId, String packageOrderId){
        throw new UnsupportedOperationException("unimplemented");
    }

    /**
     * 查询用户账单列表
     *
     * @param billQueryRequest
     * @return
     */
    List<NiiwooUserBillResponseDTO> listUserBills(BillQueryRequest billQueryRequest);

    /**
     * 分页查询用户账单列表
     *
     * @param billQueryRequest
     * @return
     */
    BillsPageResponseDTO pageUserBills(BillQueryRequest billQueryRequest);

    /**
     * 分页查询用户账单 - 从客服管理进入
     *
     * @param billQueryRequest
     * @return
     */
    PageResponseDTO<NiiwooBillRespDTO> queryUserBills(BillQueryRequest billQueryRequest);

    /**
     * 按照项目统计账单列表
     *
     * @param billQueryRequest
     * @return
     */
    PageResponseDTO<NiiwooUserProjectBillReponseDTO> pageUserBillsGroupByPackage(BillQueryRequest billQueryRequest);

    /**
     * 查询项目账单详情
     *
     * @param requestDTO
     * @return
     */
    List<NiiwooBillProjectDetailReponseDTO> queryProjectBillDetail(NiiwooBillProjectDetailRequestDTO requestDTO);

    /**
     * 查询账单详情
     *
     * @param userId
     * @param billId
     * @return
     */
    NiiwooBillDetailReponseDTO getUserBillDetail(String userId, Long billId);

    /**
     * 月份账单统计列表
     *
     * @param requestDTO
     * @return
     */
    MonthBillResponseDTO queryMonthBillDetailByMonth(MonthBillRequestDTO requestDTO);

    /**
     * 月收入列表
     *
     * @return
     */
    List<MonthBillCountResponseDTO> listMonthBill(String userId);


    /**
     * 平台账单分页
     *
     * @param billQueryRequest
     * @return
     */
    PageResponseDTO<NiiwooPlatformBillReponseDTO> pagePlatformBills(PlatformBillQueryRequest billQueryRequest);

    /**
     * 担保账单分页
     *
     * @param billQueryRequest
     * @return
     */
    PageResponseDTO<NiiwooGuaranteeBillReponseDTO> pageGuaranteeBills(GuaranteeBillQueryRequest billQueryRequest);
    /**
     *
     *担保账单
     * @param billQueryRequest
     * @return
     */
    List<NiiwooGuaranteeBillReponseDTO> listGuaranteeBills(GuaranteeBillQueryRequest billQueryRequest);

    /**
     * 担保账单分页,增加交易后剩余金额信息
     *
     * @param billQueryRequest
     * @return
     */
    PageResponseDTO<NiiwooGuaranteeBillReponseDTO> pageGuaranteeBillsWithBalanceAmount(GuaranteeBillQueryRequest billQueryRequest);
    /**
     * 担保账单,增加交易后剩余金额信息
     *
     * @param billQueryRequest
     * @return
     */
    List<NiiwooGuaranteeBillReponseDTO> listGuaranteeBillsWithBalanceAmount(GuaranteeBillQueryRequest billQueryRequest);



    /**
     * 用户机构账单分页 后台调用
     *
     * @param userBillQueryRequest
     * @return
     */
    PageResponseDTO<UserBillBackReponseDTO> pageBackstageUserBills(UserBillQueryRequest userBillQueryRequest);

    /**
     * 覃江
     * 通过存管流水号和用户ID获取账单详情
     *
     * @param requstNo 存管流水号
     * @param userId   用户id
     * @return
     */
    List<CheckAccountBillDTO> getAccountBillsByRequestNoAndUserId(String requstNo, String userId, Date bizTime);

    /**
     * 覃江
     * 通过存管流水号和用户ID获取 获取所有账单详情
     *
     * @param requstNo 存管流水号
     * @param userId   用户id
     * @return
     */
    List<CheckAccountBillDTO> getAccountMutilBillsByRequestNoAndUserId(String requstNo, String userId, Date bizTime);

    /**
     * 账单日期集合查询
     *
     * @param billDatesRequsetDTO
     * @return
     */
    List<String> queryBillDates(BillDatesRequsetDTO billDatesRequsetDTO);

    /**
     * 查询指定用户的 账户异常 统计数据
     *
     * @param userId
     * @return
     */
    UserAccountAbnormalStatisticsRespDTO findUserAmountByUserId(String userId);

    /**
     * 统计用户账单金额
     * @param userId
     * @param amountType
     * @return
     */
    BigDecimal statisticalUserBillAmount(String userId, StatisticalUserBillAmountTypeEnum amountType);

    /**
     * 统计用户月账单金额
     * @param userId 用户ID
     * @param yearMonthBill 月账单 如 201811
     * @return MonthBillResponseDTO
     */
    MonthBillResponseDTO statisticalUserMonthBill(String userId,String yearMonthBill);

}
